package com.kelvin.oocl.util;

import com.kelvin.oocl.bookconsumer.BookConsumer;
import com.kelvin.oocl.bookconsumer.BookConsumerImpl;

public class ConsumerFactory {
	private static ConsumerFactory factory;
	private static String mqUrl = "tcp://127.0.0.1:61616";
	
	private ConsumerFactory() {
	}
	
	public static ConsumerFactory newInstance(){
		if(null==factory){
			synchronized (ConsumerFactory.class) {
				if(null==factory){
					factory = new ConsumerFactory();
				}
			}
		}
		return factory;
	}
	
	public BookConsumer newBookConsumer(String queueName){
		return new BookConsumerImpl(queueName, mqUrl);
	}
}
